<!--
 * @Author: panda
 * @Date: 2022-05-18 10:07
 * @Description: 上传页面
-->
<template>
  <el-container>
    <el-header>
      <el-menu
        id="el-menu"
        class="el-menu-demo"
        mode="horizontal"
        :default-active="activeIndex"
        @select="handleSelect"
      >
        <el-menu-item index="video">视频投稿</el-menu-item>
        <el-menu-item index="article">专栏投稿</el-menu-item>
      </el-menu>
    </el-header>
    <el-main v-if="video">
      <UploadVideo />
    </el-main>
    <el-main v-else-if="article">
      <!--      ac站文章滚动条样式待定-->
      <UploadArticle />
    </el-main>
  </el-container>
</template>

<script lang="ts">
import UploadArticle from '@/components/upload/PostArticle.vue'
import UploadVideo from '@/components/upload/PostVideo.vue'
import {defineComponent, ref} from 'vue'

export default defineComponent({
  name: 'MainUpload',
  components: {UploadArticle, UploadVideo},
  setup() {
    //默认显示上传视频页
    const activeIndex = ref('video')
    //切换视频上传
    const video = ref(true)
    //切换文章上传
    const article = ref(false)

    const handleSelect = (key: string) => {
      video.value = key === 'video'
      article.value = key === 'article'
    }

    return {
      activeIndex,
      handleSelect,
      video,
      article,
    }
  }

})
</script>

<style scoped>

</style>
